package com.jy.wms.controller;

import com.jy.wms.common.SetStatus;
import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.SetAndModifyModel;
import com.jy.wms.pojo.WmsRejectedDetailed;
import com.jy.wms.service.WmsRejectedDetailedService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @ClassName: WmsRejectedDetailedController
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author Jane
 * @Date Tue Jan 16 17:57:05 CST 2018
 */
@RestController
@RequestMapping("/wmsRejectedDetailed")
@Api(value = "/wmsRejectedDetailed", description = "退货明细")
public class  WmsRejectedDetailedController extends BaseController<WmsRejectedDetailedService,WmsRejectedDetailed> {


    @ApiOperation(value = "制作退货单页面", response = JSONObject.class, notes = "制作退货单页面")
    @PostMapping(value = "/list")
    public @ResponseBody
    JSONObject list(@RequestBody SetAndModifyModel setAndModifyModel) {
        JSONObject json = getJSONObject();
        try {
            List<Map<String,Object>> list = baseService.getSoDetailed(setAndModifyModel.getIds());
            json = SetStatus.setSearchType(JSONArray.fromObject(list).toString(),list.size());

        } catch (Exception e) {
            e.printStackTrace();
        }
        return json;
    }

}
